package com.example.demo.controller;
import com.example.demo.entity.Stu;
import com.example.demo.service.StuServices;
import com.example.demo.dto.ResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
@RequestMapping("/stu")
public class StuController {


    @Autowired
    StuServices stuServices;
    @RequestMapping("getAll.action")
    public ResultDTO getAll(){
        ResultDTO resultDTO=new ResultDTO();
        resultDTO.setResult(true);
        resultDTO.setMessage("学生查询成功");
        ArrayList<Stu> stus = stuServices.getAll();
        resultDTO.setData(stus);
        return  resultDTO;
    }
}
